<?php
if ( !isGod() )
	if ( !getRights($mod,'edit') )
	{
		showMsg('Không có quyền truy cập vào trang này !','error','center');
		die();
	}
//lay ten chu de
$un = (!get_magic_quotes_gpc()) ? addslashes(@$_GET['un']) : @$_GET['un'];
$old_gid = (!get_magic_quotes_gpc()) ? addslashes(@$_GET['gid']) : intval(@$_GET['gid']);

if ( empty($un) || empty($old_gid) )
	die('Không thực hiện được thao tác này !');

//lay ten cua group cu
$sql = "SELECT * FROM um_group WHERE gid=$old_gid";
$rs_g = $link->execute($sql);
$old_gname = $rs_g->fields('gname');

$sql = "SELECT * FROM um_group WHERE gid NOT IN($old_gid)";
$rs_g = $link->execute($sql);

echo '<form name="frmMoveUser" method="POST" action="admin.php?mod=UManager&act=process_swap_user">';
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">';
echo '<tr><td align="center">&nbsp; Chuyển <font color="#CC6600"><b>' . $_SESSION['sesusername'] . '</b></font> từ nhóm <font color="#009900"><b>' . $old_gname . '</b></font> sang nhóm ';
echo '&nbsp;<select name="cboNewGroup">';
while ( !$rs_g->EOF )
{
	echo '<option value="' . $rs_g->fields('gid') . '">' . $rs_g->fields('gname') . '</option>';

	$rs_g->movenext();
}
echo '</select>';
echo '&nbsp;<input type="submit" name="cmdOK" value="Chuyển người dùng &raquo;">';
echo '<tr><td>&nbsp;</td></tr>';
echo '</td></tr>';
echo '<tr><td height="21" bgcolor="#6699CC" class="clsTitle">&nbsp;Thông tin về người dùng</td></tr>';

$sql = "SELECT * FROM um_user WHERE username='$un'";
$rs = $link->execute($sql);

?>
<table width="100%"  border="0" cellspacing="1" cellpadding="0" bgcolor="#F5F5F5">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>  
  <tr>
    <td>&nbsp;Tên đăng nhập</td>
    <td>&nbsp;<input style="background-color: #FFFFCC" disabled name="txtUsername" type="text" size="30" maxlength="15" value="<?= $rs->fields('username') ?>"></td>
  </tr>
  <tr>
    <td>&nbsp;Mật khẩu</td>
    <td>&nbsp;<input  style="background-color: #FFFFCC" disabled name="txtPwd" type="text" size="30" maxlength="15" value="[Mật khẩu cũ]"></td>
  </tr>
  <tr>
    <td>&nbsp;Tên thật</td>
    <td>&nbsp;<input disabled name="txtRealName" type="text" size="50" maxlength="50" value="<?= $rs->fields('realname') ?>"></td>
  </tr>
  <tr>
    <td>&nbsp;Địa chỉ Email</td>
    <td>&nbsp;<input  style="background-color: #FFFFCC" disabled name="txtEmail" type="text" size="50" maxlength="255" value="<?= $rs->fields('email') ?>"></td>
	<input type="hidden" name="un" value="<?= $un ?>">
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

<?php
	echo '<tr><td valign="top">';
	echo '</td></tr>';
	echo '</table>';
	echo '</form>';
?>